<%-- 
    Document   : AddConsultant
    Created on : Feb 27, 2014, 11:03:27 AM
    Author     : Mukesh
--%>

<%@page import="PurchaseOrder.PurchaseOrderBean"%>
<%@page import="StoreType.StoreTypeBean"%>
<%@page import="Vendor.VendorBean"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.Vector"%>
<%
    try {
        if (session.getAttribute("uid") != null) {
            if (session.getAttribute("Receive_Order").toString().equals("1")) {
%>
<%String to = "", status = "", msg = "";%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <title>Ramgovind Automated System</title>
        <link rel="stylesheet" href="/RIT/css/bootstrap.css">
        <link rel="stylesheet" href="/RIT/css/bootstrap-responsive.css">
        <link rel="stylesheet" href="/RIT/css/jquery.fancybox.css">
        <link rel="stylesheet" href="/RIT/css/style.css">
        <link rel="stylesheet" href="/RIT/css/iconfont.css">
        <link rel="stylesheet" href="/RIT/css/bootstrap.datepicker.css">
        <script src="../../ajax/ajax.js"></script>
        <script>
            function total(iqty, iunit, itax, returnOut, itamnt) {
                var qty = parseInt(document.getElementById(iqty).value);
                qty = qty - parseInt(returnOut);
                var unit = parseInt(document.getElementById(iunit).value);
                var tax = parseInt(document.getElementById(itax).value);
                var tamnt = (((qty * unit) / 100) * tax) + (qty * unit);
                document.getElementById(itamnt).value = tamnt;
            }
            function payType(val) {
                if (val == 2 || val == 3) {
                    document.getElementById('ddno').disabled = false;
                    document.getElementById('bank').disabled = false;
                    document.getElementById('branch').disabled = false;
                    document.getElementById('hide').removeAttribute('style');
                }
                else {
                    document.getElementById('ddno').disabled = true;
                    document.getElementById('bank').disabled = true;
                    document.getElementById('branch').disabled = true;
                    document.getElementById('hide').style.display = 'none';
                }

            }
        </script>
    </head>
    <body>
        <%@include file="/topheader.html" %>
        <%@include file="/servicesheader.html" %>
        <div class="main">
            <div class="container-fluid">
                <%@include file="/Services/Inventory/inventorysidenav.jsp" %>
                <div class="content">

                    <div class="row-fluid">
                        <div class="span12">
                            <div class="box">
                                <div class="box-head">
                                    <h3>Receive Order</h3>

                                </div>
                                <%{

                                        PurchaseOrderBean pob = (PurchaseOrderBean) request.getAttribute("pob");
                                        VendorBean vb = pob.getVendorBean();
                                        if (pob.getOrderId() != 0) {
                                %>
                                <form action="/RIT/ReceiveOrder" method="post" class='validate form-horizontal'>
                                    <div class="box-content">
                                        <!---Form Start....-->

                                        <div id="lside" style="float: left; margin-top: 10px;">
                                            <div class="control-group">
                                                <label for="pname" class="control-label">Product Name<span style="color:red"></span></label>
                                                <div class="controls">
                                                    <input type="text" name="pname" id="pname" value="<%=pob.getProductName()%>"readonly="">
                                                    <input type="hidden" name="orderId" id="orderId" value="<%=pob.getOrderId()%>"readonly="">
                                                    <input type="hidden" name="reqFrom" value="">
                                                </div>
                                            </div>
                                            <div class="control-group">
                                                <label for="email" class="control-label">Vendor<span style="color:red"></span></label>
                                                <div class="controls">
                                                    <input type="text" name="vendor" id="vendor" value="<%=vb.getVendorName()%>" readonly>
                                                </div>
                                            </div>
                                            <div class="control-group">
                                                <label for="email" class="control-label">Approval No.<span style="color:red">*</span></label>
                                                <div class="controls">
                                                    <input type="text" name="approvalNo" id="approvalNo" class="required number">
                                                </div>
                                            </div>
                                            <div class="control-group">
                                                <label for="tax" class="control-label">TAX<span style="color:red"></span></label>
                                                <div class="controls">
                                                    <input type="text" name="tax" id="tax" value="<%=pob.getTax()%>" readonly>%
                                                </div>
                                            </div>
                                            <div class="control-group">
                                                <label for="email" class="control-label">Quantity<span style="color:red"></span></label>
                                                <div class="controls">
                                                    <input type="text" name="qty" id="qty" value="<%=pob.getQty()%>" readonly>
                                                </div>
                                            </div>
                                            <div class="control-group">
                                                <label for="unitprice" class="control-label">Unit Price<span style="color:red"></span></label>
                                                <div class="controls">
                                                    <input type="text" name="unitprice" id="unitprice" value="<%=pob.getUnitPrice()%>" readonly>
                                                </div>
                                            </div>

                                        </div>
                                        <div id="rside" style="float: left; margin-right: 120px; margin-top: 10px">
                                            <div class="control-group">
                                                <label for="email" class="control-label">Return Outwards<span style="color:red">*</span></label>
                                                <div class="controls">
                                                    <input type="text" name="return" id="return" class='required number'onblur="total('qty', 'unitprice', 'tax', this.value, 'tamnt')">
                                                </div>
                                            </div>

                                            <div class="control-group">
                                                <label for="tamnt" class="control-label">Total Amount<span style="color:red"></span></label>
                                                <div class="controls">
                                                    <input type="text" name="tamnt" id="tamnt" readonly>
                                                </div>
                                            </div>
                                            <div class="control-group">
                                                <label for="vendor" class="control-label">Payment Type<span style="color:red">*</span></label>
                                                <div class="controls">
                                                    <select class="required" name="paytype" id="payteyp" onchange="payType(this.value)">
                                                        <option value="">Select Pay Type</option>
                                                        <option value="1">Cash</option>
                                                        <option value="2">Cheque</option>
                                                        <option value="3">Demand Draft</option>
                                                    </select>
                                                </div>
                                            </div>
                                            <div id="hide" style="display: none">
                                                <div class="control-group">
                                                    <label for="tax" class="control-label">Check/DD No.<span style="color:red">*</span></label>
                                                    <div class="controls">
                                                        <input type="text" name="ddno" id="ddno" class='required ' disabled>
                                                    </div>
                                                </div>
                                                <div class="control-group">
                                                    <label for="tax" class="control-label">Bank Name<span style="color:red">*</span></label>
                                                    <div class="controls">
                                                        <input type="text" name="bank" id="bank" class='required ' disabled>
                                                    </div>
                                                </div>
                                                <div class="control-group">
                                                    <label for="tax" class="control-label">Branch Name<span style="color:red">*</span></label>
                                                    <div class="controls">
                                                        <input type="text" name="branch" id="branch" class='required ' disabled>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="control-group">
                                                <label for="desc" class="control-label">Description<span style="color:red"></span></label>
                                                <div class="controls">
                                                    <textarea name="desc" id="desc" style="height: 120px;"></textarea>
                                                </div>
                                            </div>
                                        </div>
                                        <!---Form Ends....-->
                                    </div>
                                    <div class="form-actions">
                                        <input type="submit" class='btn btn-primary'>
                                    </div>
                                </form>
                                <%} else {
                                            response.sendRedirect("/RIT/Services/Inventory/ReceiveOrder.jsp?status=0");
                                        }

                                    }%>
                            </div>
                        </div>
                    </div>
                </div>	
            </div>
        </div>
        <script src="/RIT/js/jquery.js"></script>
        <script src="/RIT/js/less.js"></script>
        <script src="/RIT/js/bootstrap.min.js"></script>
        <script src="/RIT/js/jquery.uniform.min.js"></script>
        <script src="/RIT/js/bootstrap.timepicker.js"></script>
        <script src="/RIT/js/bootstrap.datepicker.js"></script>
        <script src="/RIT/js/chosen.jquery.min.js"></script>
        <script src="/RIT/js/jquery.fancybox.js"></script>
        <script src="/RIT/js/plupload/plupload.full.js"></script>
        <script src="/RIT/js/plupload/jquery.plupload.queue/jquery.plupload.queue.js"></script>
        <script src="/RIT/js/jquery.cleditor.min.js"></script>
        <script src="/RIT/js/jquery.inputmask.min.js"></script>
        <script src="/RIT/js/jquery.tagsinput.min.js"></script>
        <script src="/RIT/js/jquery.mousewheel.js"></script>
        <script src="/RIT/js/jquery.textareaCounter.plugin.js"></script>
        <script src="/RIT/js/ui.spinner.js"></script>
        <script src="/RIT/js/jquery.jgrowl_minimized.js"></script>
        <script src="/RIT/js/jquery.form.js"></script>
        <script src="/RIT/js/jquery.validate.min.js"></script>
        <script src="/RIT/js/bbq.js"></script>
        <script src="/RIT/js/jquery-ui-1.8.22.custom.min.js"></script>
        <script src="/RIT/js/jquery.form.wizard-min.js"></script>
        <script src="/RIT/js/jquery.cookie.js"></script>
        <script src="/RIT/js/jquery.metadata.js"></script>
        <script src="/RIT/js/custom.js"></script><script src="/RIT/js/demo.js"></script>
        <script src="/RIT/js/iconfont.js"></script>
    </body>
</html>

<%} else {
%>
<script type="text/javascript">
                                                        alert("You Are Not Authorised");
                                                        window.history.back();
</script>
<%             }
        } else {
            request.setAttribute("msg", "You Are Not Authorised! Please Contact to System Administrator!");
            request.setAttribute("value", "0");
            getServletContext().getRequestDispatcher("/index.jsp").forward(request, response);
        }
    } catch (Exception e) {
        request.setAttribute("msg", "Please Contact to System Administrator!");
        request.setAttribute("value", "0");
        getServletContext().getRequestDispatcher("/index.jsp").forward(request, response);
    }
%>

